package cn.sc.allinpay.allfavour.business.checkdetail;

import android.os.Bundle;
import android.support.v7.widget.AppCompatTextView;
import android.view.View;
import android.widget.LinearLayout;

import butterknife.BindView;
import butterknife.OnClick;
import cn.sc.allinpay.allfavour.R;
import cn.sc.allinpay.allfavour.base.activity.BaseActivity;


/**
 * activity 验券详情
 * author：pany
 * on 2017/12/1 11:14
 */
public class CheckDetailActivity extends BaseActivity<CheckDetailContract.View, CheckDetailContract.Presenter>
        implements CheckDetailContract.View {

    @BindView(R.id.llCoupon)
    LinearLayout llCoupon;

    @Override
    protected int layoutId() {
        return R.layout.activity_check_detail;
    }

    @Override
    protected void layoutTitle(View top, AppCompatTextView left, AppCompatTextView title, AppCompatTextView right) {
        title.setText("验券");
    }

    @Override
    protected CheckDetailContract.Presenter bindPresenter() {
        return new CheckDetailPresenter();
    }

    @Override
    protected void layoutContent(Bundle savedInstanceState) {

    }

    @Override
    public void addCouponView(String couponName, String couponAmt, String remark) {
        View view = View.inflate(this, R.layout.layout_check_detail, null);
        AppCompatTextView name = view.findViewById(R.id.tvCouponsName);
        name.setText(couponName);
        AppCompatTextView tvUse = view.findViewById(R.id.tvUse);
        tvUse.setText(couponAmt);
        AppCompatTextView tvRemark = view.findViewById(R.id.tvRemark);
        tvRemark.setText("备注："+remark);
        llCoupon.addView(view);
    }

    @OnClick({R.id.btnCheck})
    void btnClick(View view) {
        switch (view.getId()) {
            case R.id.btnCheck:
                presenter.reqCheckCoupon();
                break;
        }
    }
}
